package com.ruijie.acl.web;

import java.io.File;

import javax.faces.context.FacesContext;
import javax.servlet.http.HttpServletRequest;

import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.ScopeType;

import com.ruijie.foundation.bo.EntityObject;
import com.ruijie.foundation.service.Repository;

@Name("systemInfoAction")
@Scope(ScopeType.APPLICATION)
public class SystemInfoAction extends AclBaseAction {

	
	/**
	 * 根据浏览器语言选择首页的flash页面
	 * @return
	 */
	public String getFilePathByIELang(){
		HttpServletRequest request=(HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext()
		.getRequest();
		//浏览器语言
		String lang=request.getLocale()==null?null:request.getLocale().toString().toLowerCase();
		if(lang!=null){
			String path= request.getSession().getServletContext().getRealPath("")+"\\acl\\images\\acl_index_"+lang+".swf";
			File file=new File(path);
			if(file.exists()){
				//与浏览器语言对应的flash
				return "images/acl_index_"+lang+".swf";
			}else{
				String prefix=lang.substring(0,2);
				path=request.getSession().getServletContext().getRealPath("")+"\\acl\\images\\acl_index_"+prefix+".swf";
				if(new File(path).exists()){
					//与浏览器语言的前缀对应的flash
					return "images/acl_index_"+prefix+".swf";					
				}
			}		
		}
		//返回默认的flash
		return 	"images/acl_index.swf";
	}
	@Override
	protected Repository getRepository() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected String getAddPage() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public EntityObject getCriteria() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected String getDetailPage() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected String getListPage() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public EntityObject getModel() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	protected String getUpdatePage() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public void resetModel() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setCriteria(EntityObject criteria) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void setModel(EntityObject model) {
		// TODO Auto-generated method stub
		
	}

	
}
